<template>
      <el-container class="main_container">
        <!--侧边栏-->
        <el-aside v-bind:width="isCollapse?'65px':'200px'">
          <!--展开/收起-->
          <div class="toggle-box" @click="toggleCollapse">|||</div>
          <el-menu
            default-active="2"
            class="el-menu-vertical-demo"
            @open=""
            @close=""
            background-color="#001529"
            text-color="#fff"
            active-text-color="#ffd04b"
            :collapse="isCollapse"
            :default-active="activePath"
            :collapse-transition="false"
            :unique-opened="true"
            :router="true">
            <!--导航菜单-->
            <index_moudle :menuList="this.MenuList"></index_moudle>
          </el-menu>
        </el-aside>

        <el-container>
          <el-header>Header</el-header>
          <el-main>
            <!--路由视图-->
            <router-view/>
          </el-main>
          <el-footer>Footer</el-footer>
        </el-container>
      </el-container>
</template>

<script>
  import index_moudle from "../common/index_moudle"
  import hello from "./Permission"
    export default {
        name: "index",
        components:{
            index_moudle,
            hello
        },
        data(){
            return{
                isCollapse: false,
                activePath:'',
                /*导航菜单信息*/
                MenuList:[
                    {
                        "id": 1,
                        "parentId": 0,
                        "menuName": "学习系统",
                        "url": "",
                        "icon": "el-icon-setting",
                        "orderNum": 1,
                        "open": 1,
                        "disabled": false,
                        "perms": null,
                        "type": 0,
                        "children": [
                            {
                                "id": 253,
                                "parentId": 1,
                                "menuName": "课程列表",
                                "url": "/hello",
                                "icon": "el-icon-star-off",
                                "orderNum": 1,
                                "open": 0,
                                "disabled": false,
                                "perms": "welcome:view",
                                "type": 0,
                                "children": []
                            },
                            {
                                "id": 226,
                                "parentId": 1,
                                "menuName": "我的课程",
                                "url": "/helloo",
                                "icon": "el-icon-user",
                                "orderNum": 2,
                                "open": 0,
                                "disabled": false,
                                "perms": "users",
                                "type": 0,
                                "children": []
                            },
                            {
                                "id": 227,
                                "parentId": 1,
                                "menuName": "模拟题库",
                                "url": "/users",
                                "icon": "el-icon-user",
                                "orderNum": 2,
                                "open": 0,
                                "disabled": false,
                                "perms": "users",
                                "type": 0,
                                "children": []
                            },{
                                "id": 228,
                                "parentId": 1,
                                "menuName": "bug查找",
                                "url": "/users",
                                "icon": "el-icon-user",
                                "orderNum": 2,
                                "open": 0,
                                "disabled": false,
                                "perms": "users",
                                "type": 0,
                                "children": []
                            }
                        ]
                        /*--------------*/
                    },
                    {
                        "id": 2,
                        "parentId": 0,
                        "menuName": "作业系统",
                        "url": "",
                        "icon": "el-icon-setting",
                        "orderNum": 1,
                        "open": 1,
                        "disabled": false,
                        "perms": null,
                        "type": 0,
                        "children": [
                            {
                                "id": 240,
                                "parentId": 2,
                                "menuName": "作业列表",
                                "url": "/users",
                                "icon": "el-icon-user",
                                "orderNum": 2,
                                "open": 0,
                                "disabled": false,
                                "perms": "users",
                                "type": 0,
                                "children": []
                            },
                            {
                                "id": 248,
                                "parentId": 2,
                                "menuName": "布置作业",
                                "url": "/users",
                                "icon": "el-icon-user",
                                "orderNum": 2,
                                "open": 0,
                                "disabled": false,
                                "perms": "users",
                                "type": 0,
                                "children": []
                            },
                            {
                                "id": 249,
                                "parentId": 2,
                                "menuName": "报告",
                                "url": "/users",
                                "icon": "el-icon-user",
                                "orderNum": 2,
                                "open": 0,
                                "disabled": false,
                                "perms": "users",
                                "type": 0,
                                "children": []
                            }
                        ]
                    },
                    {
                        "id": 3,
                        "parentId": 0,
                        "menuName": "考试系统",
                        "url": "",
                        "icon": "el-icon-setting",
                        "orderNum": 1,
                        "open": 1,
                        "disabled": false,
                        "perms": null,
                        "type": 0,
                        "children": [
                            {
                            "id": 331,
                            "parentId": 3,
                            "menuName": "我的考试",
                            "url": "/users",
                            "icon": "el-icon-user",
                            "orderNum": 2,
                            "open": 0,
                            "disabled": false,
                            "perms": "users",
                            "type": 0,
                            "children": []
                        },
                            {
                                "id": 332,
                                "parentId": 3,
                                "menuName": "考试记录",
                                "url": "/users",
                                "icon": "el-icon-user",
                                "orderNum": 2,
                                "open": 0,
                                "disabled": false,
                                "perms": "users",
                                "type": 0,
                                "children": []
                            }
                        ]
                    },
                    {
                        "id": 4,
                        "parentId": 0,
                        "menuName": "检测系统",
                        "url": "",
                        "icon": "el-icon-setting",
                        "orderNum": 1,
                        "open": 1,
                        "disabled": false,
                        "perms": null,
                        "type": 0,
                        "children": [
                            {
                                "id": 335,
                                "parentId": 4,
                                "menuName": "自我检测",
                                "url": "/users",
                                "icon": "el-icon-user",
                                "orderNum": 2,
                                "open": 0,
                                "disabled": false,
                                "perms": "users",
                                "type": 0,
                                "children": []
                            },
                            {
                                "id": 336,
                                "parentId": 4,
                                "menuName": "检测记录",
                                "url": "/users",
                                "icon": "el-icon-user",
                                "orderNum": 2,
                                "open": 0,
                                "disabled": false,
                                "perms": "users",
                                "type": 0,
                                "children": []
                            },
                            {
                                "id": 337,
                                "parentId": 4,
                                "menuName": "我的错题集",
                                "url": "/users",
                                "icon": "el-icon-user",
                                "orderNum": 2,
                                "open": 0,
                                "disabled": false,
                                "perms": "users",
                                "type": 0,
                                "children": []
                            }
                        ]
                    },
                    {
                        "id": 5,
                        "parentId": 0,
                        "menuName": "校内博客",
                        "url": "",
                        "icon": "el-icon-setting",
                        "orderNum": 1,
                        "open": 1,
                        "disabled": false,
                        "perms": null,
                        "type": 0,
                        "children": [
                            {
                                "id": 338,
                                "parentId": 5,
                                "menuName": "我的博客",
                                "url": "/users",
                                "icon": "el-icon-user",
                                "orderNum": 2,
                                "open": 0,
                                "disabled": false,
                                "perms": "users",
                                "type": 0,
                                "children": []
                            },
                            {
                                "id": 339,
                                "parentId": 5,
                                "menuName": "与我相关",
                                "url": "/users",
                                "icon": "el-icon-user",
                                "orderNum": 2,
                                "open": 0,
                                "disabled": false,
                                "perms": "users",
                                "type": 0,
                                "children": []
                            },
                            {
                                "id": 380,
                                "parentId": 5,
                                "menuName": "发表博客",
                                "url": "/users",
                                "icon": "el-icon-user",
                                "orderNum": 2,
                                "open": 0,
                                "disabled": false,
                                "perms": "users",
                                "type": 0,
                                "children": []
                            }
                        ]
                    },
                    {
                        "id": 6,
                        "parentId": 0,
                        "menuName": "账户管理",
                        "url": "",
                        "icon": "el-icon-setting",
                        "orderNum": 1,
                        "open": 1,
                        "disabled": false,
                        "perms": null,
                        "type": 0,
                        "children": [
                            {
                                "id": 430,
                                "parentId": 6,
                                "menuName": "个人信息",
                                "url": "/users",
                                "icon": "el-icon-user",
                                "orderNum": 2,
                                "open": 0,
                                "disabled": false,
                                "perms": "users",
                                "type": 0,
                                "children": []
                            },{
                                "id": 431,
                                "parentId": 6,
                                "menuName": "修改密码",
                                "url": "/users",
                                "icon": "el-icon-user",
                                "orderNum": 2,
                                "open": 0,
                                "disabled": false,
                                "perms": "users",
                                "type": 0,
                                "children": []
                            }
                        ]
                    },
                    {
                        "id": 7,
                        "parentId": 0,
                        "menuName": "系统设置",
                        "url": "",
                        "icon": "el-icon-setting",
                        "orderNum": 1,
                        "open": 1,
                        "disabled": false,
                        "perms": null,
                        "type": 0,
                        "children": [
                            {
                                "id": 431,
                                "parentId": 7,
                                "menuName": "用户列表",
                                "url": "/users",
                                "icon": "el-icon-user",
                                "orderNum": 2,
                                "open": 0,
                                "disabled": false,
                                "perms": "users",
                                "type": 0,
                                "children": []
                            },
                            {
                                "id": 434,
                                "parentId": 7,
                                "menuName": "角色列表",
                                "url": "/users",
                                "icon": "el-icon-user",
                                "orderNum": 2,
                                "open": 0,
                                "disabled": false,
                                "perms": "users",
                                "type": 0,
                                "children": []
                            },
                            {
                                "id": 436,
                                "parentId": 7,
                                "menuName": "权限列表",
                                "url": "/permission",
                                "icon": "el-icon-user",
                                "orderNum": 2,
                                "open": 0,
                                "disabled": false,
                                "perms": "users",
                                "type": 0,
                                "children": []
                            }
                        ]
                    }
                ]
            }
        },
        methods:{
            toggleCollapse(){
                this.isCollapse=!this.isCollapse;
            }
        }
    }
</script>

<style lang="less" scoped>
  /*设置整个容器的高度*/
  .main_container{
    height: 100%;
  }

  .el-header, .el-footer {
    background-color: #B3C0D1;
    color: #333;
    /*text-align: center;*/
    line-height: 60px;
  }

  .el-aside {
    background-color: #D3DCE6;
    color: #333;
   /* text-align: center;*/
    line-height: 200px;
  }

  .el-main {
    background-color: #E9EEF3;
  }

  body > .el-container {
    margin-bottom: 40px;
  }

  .el-container:nth-child(5) .el-aside,
  .el-container:nth-child(6) .el-aside {
    line-height: 260px;
  }

  .el-container:nth-child(7) .el-aside {
    line-height: 320px;
  }
  /*展开/收起*/
  .toggle-box{
    background-color: chartreuse;
    font-size: 15px;
    font-weight: bold;
    line-height: 25px;
    color: #FFFFFF;
    /*设置字体之间的距离*/
    letter-spacing: 0.2em;
    text-align: center;
    cursor: pointer;
  }

  /*侧边栏*/
  .el-aside {
    background-color: #001529;
  }
  /*去掉导航菜单边框*/
  .el-menu{
    border-right: none;
  }

  /*下拉菜单的样式*/
  .el-dropdown-link {
    cursor: pointer;
    color: #409EFF;
  }
</style>
